{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/ajay/contracode\n"
     ]
    }
   ],
   "source": [
    "%cd ~/contracode\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import pickle\n",
    "import gzip\n",
    "from tqdm.auto import tqdm\n",
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/git/ext/gitdb', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/wandb/vendor/graphql-core-1.1', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/wandb/vendor/gql-0.2.0', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/wandb/vendor', '/home/ajay/contracode/nb', '/home/ajay/miniconda3/envs/paras/lib/python38.zip', '/home/ajay/miniconda3/envs/paras/lib/python3.8', '/home/ajay/miniconda3/envs/paras/lib/python3.8/lib-dynload', '', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages', '/home/ajay/contracode', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/IPython/extensions', '/home/ajay/.ipython', '/home/ajay/miniconda3/envs/paras/lib/python3.8/site-packages/gitdb/ext/smmap']\n"
     ]
    },
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'models'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-2-ae797d48e731>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     18\u001b[0m \u001b[0;31m# sys.path.append(\"..\")\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 20\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtypetransformer\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTypeTransformer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     21\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdeeptyper_dataset\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDeepTyperDataset\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mload_type_vocab\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_collate_fn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     22\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutil\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTimer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'models'"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import random\n",
    "\n",
    "import fire\n",
    "import numpy as np\n",
    "import sentencepiece as spm\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "import torch.nn.functional as F\n",
    "import tqdm\n",
    "import wandb\n",
    "from loguru import logger\n",
    "\n",
    "import sys\n",
    "print(sys.path)\n",
    "# sys.path.append(\"/home/ajay/contracode\")\n",
    "# sys.path.append(\"/home/ajay/contracode/representjs\")\n",
    "# sys.path.append(\"..\")\n",
    "\n",
    "from models.typetransformer import TypeTransformer\n",
    "from data.deeptyper_dataset import DeepTyperDataset, load_type_vocab, get_collate_fn\n",
    "from data.util import Timer\n",
    "from representjs import RUN_DIR\n",
    "from utils import count_parameters, get_linear_schedule_with_warmup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "eval_dataset = DeepTyperDataset(\n",
    "    eval_filepath,\n",
    "    type_vocab_filepath,\n",
    "    spm_filepath,\n",
    "    max_length=max_eval_seq_len,\n",
    "    subword_regularization_alpha=subword_regularization_alpha,\n",
    "    split_source_targets_by_tab=eval_filepath.endswith(\".json\")\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
